{extend name="ashippingguide/Public/base" /}
{block name="container"}
<div class="page-heade">
    <h2 class="title_color text-center">导购薪资基本资料管理</h2>
</div>
<form action="" class="form-inline" id="form1" method="post">
    <table class="table table-bordered bud_hei">
        <tr>
            <td>模糊查询：</td>
            <td>姓名：</td>
            <td><input type="text" class="form-control" name="name"
                       value="<?php if(isset($where['name'])) echo $where['name']; ?>"></td>
            <td>所属城市：</td>
            <td><input type="text" class="form-control" name="livingCity"
                       value="<?php if(isset($where['livingCity'])) echo $where['livingCity']; ?>"></td>
            <td>网点名称：</td>
            <td><input type="text" class="form-control" name="mainNet"
                       value="<?php if(isset($where['mainNet'])) echo $where['mainNet']; ?>"></td>
            <td>
                <button class="btn-sm btn-info btn" type="submit">查询</button>
                <span class="lr_5"></span>
                <button class="btn-sm btn-info btn" type="reset" id="reset">清空查询条件</button>
            </td>
        </tr>
    </table>
    <table class="table table-striped table-bordered table-hover bud_hei text-center">
        <tr class="info">
            <th class="text-center">No.</th>
            <th class="text-center">姓名</th>
            <th class="text-center" style="width: 50%">标准网点名称</th>
            <th class="text-center">目前状态</th>
            <th class="text-center">开户银行</th>
            <th class="text-center">银行账号</th>
            <th class="text-center">维护</th>
        </tr>
        <tbody style="border: 0">
        {volist name="data" id="list"}
        <tr>
            <td>{$i}</td>
            <td><a href="{:url('ashippingguide/guideInfo')}?id={$list.id}">{$list.name}</a></td>
            <td class="text-left">{$list.mainNet}</td>
            <td>{$list.nowState}</td>
            <td>{$list.openingBank}</td>
            <td>{$list.bankAccount}</td>
            <td><a href="javascript:;" onclick="edit({$list.id})" class="modify">修改</a></td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <h5 class="text-center" style="font-size: 13px;font-weight: 500">
        总共有{$count}条记录，第{$page}/{$maxpage}页,当前页<input id="page" name="pages" type="text" style="width: 40px" value="1"/>
        <button id="gopage">Go</button>&nbsp;&nbsp;<button
            id="fistpage" onclick="$('#form1').find('input').val('');">首页
    </button>&nbsp;&nbsp;
        每页显示
        <select id="pagesize" name="limts">
            <option value='10' selected>10条</option>
            <option value='15'>15条</option>
            <option value='20'>20条</option>
        </select>
        <script>
            $('#pagesize').val("{$limit}");
        </script>
    </h5>
</form>
<!--<div class="ibox-content" style="display: none;" id="xinzijb">
    <form action="" class="form-inline" id="form2">
        <table class="table table-bordered text-center">
            <tr>
                <td style="width: 140px">薪资级别名称</td>
                <td class="text-left">A1</td>
            </tr>
            <tr>
                <td>基本工资(元/月)</td>
                <td class="text-left">2500</td>
            </tr>
            <tr>
                <td>所属城市类别</td>
                <td class="text-left">一类城市</td>
            </tr>
        </table>
    </form>
</div>-->
<div class="ibox-content" style="display: none;" id="modifyDiv">
    <form action="{:url('Ashippingguide/bankEdit')}" class="form-inline" method="post" id="form2">
        <table class="table table-bordered text-center">
            <input type="hidden" id="id" name="id" value="">
            <tr>
                <td>职员姓名</td>
                <td class="text-left" id="xml"></td>
            </tr>
            <tr>
                <td>开户银行名称<span class="colorRed">*</span></td>
                <td class="text-left"><input type="text" class="form-control validate[required]" id="openingBank"
                                             name="openingBank" value="" style="width: 80%"></td>
            </tr>
            <tr>
                <td>银行账号<span class="colorRed">*</span></td>
                <td class="text-left"><input type="text" maxlength="22" class="form-control validate[required,custom[onlyNumberSp],minSize[18],maxSize[22]]" id="bankAccount"
                                             name="bankAccount" value="" style="width: 80%"></td>
                <script>
                    document.getElementById('bankAccount').onkeyup = function (event) {
                        var v = this.value;
                        if (/\S{5}/.test(v)) {
                            this.value = v.replace(/\s/g, '').replace(/(.{4})/g, "$1 ");
                        }
                    }
                </script>
            </tr>
        </table>
    </form>
</div>
<script>
    //表单验证
    $('#form2').validationEngine('attach', {
        promptPosition: 'bottomRight'
    });
    //     $(".seedetail").click(function(){
    //         layer.open({
    //             type: 1,
    //             title: '薪资级别详情',
    //             area: ['800px', '500px'],
    //             fixed: false, //不固定
    //             maxmin: true,
    //             content: $('#xinzijb')
    //             /*   yes: function (i, o) {
    //                    var param = $('#form1').serialize()
    //                $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
    //                    if (data.success) {
    //                        swal({title: data.msg}, function () {
    //                            layer.close(i)
    //                            location.reload()
    //                        })
    //                    } else {
    //                        swal(data.msg)
    //                    }
    //                }, 'json')
    //            }
    // */
    //         });
    //     })


    $(document).ready(function () {
        $('#reset').on('click', function () {
            $("#form1 input").each(function () {
                $(this).val('');
            });
            $("#form1 select").each(function () {
                $(this).val('');
            });
            $('#form1').submit();
            return false
        })
    })

    /*返回*/
    /*   $('#fanhui').on('click',function () {
                      // parent.layer.close(parent.layer.getFrameIndex(window.name))
                      location.reload();
                       return false
                   })*/
    /*修改*/
    function edit(id) {
        $.get("{:url('ashippingguide/editBankP')}", {id: id}, function (e) {
            console.log(e.name);
            $('#id').val(e.id);
            $('#xml').text(e.name);
            $('#openingBank').val(e.openingBank);
            $('#bankAccount').val(e.bankAccount);
            layer.open({
                type: 1,
                title: '修改导购薪酬基本资料',
                area: ['800px', '500px'],
                fixed: false, //不固定
                maxmin: true,
                btn: ['提交', '返回'],
                content: $('#modifyDiv'),
                yes: function (i, o) {
                    $('#form2').submit();
                }
                /*   yes: function (i, o) {
                  var param = $('#form1').serialize()
              $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
                  if (data.success) {
                      swal({title: data.msg}, function () {
                          layer.close(i)
                          location.reload()
                      })
                  } else {
                      swal(data.msg)
                  }
              }, 'json')
          }
    */

            });
        }, 'json');
    }

    //     $(document).on("click",".modify",function(){
    //         layer.open({
    //             type: 1,
    //             title: '修改导购薪酬基本资料',
    //             area: ['800px', '500px'],
    //             fixed: false, //不固定
    //             maxmin: true,
    //             btn:['提交','返回'],
    //             content: $('#modifyDiv'),
    //             /*   yes: function (i, o) {
    //               var param = $('#form1').serialize()
    //           $.post('/index/workflowdb/ysfy_cg.html', param, function (data) {
    //               if (data.success) {
    //                   swal({title: data.msg}, function () {
    //                       layer.close(i)
    //                       location.reload()
    //                   })
    //               } else {
    //                   swal(data.msg)
    //               }
    //           }, 'json')
    //       }
    // */
    //
    //         });
    //
    //     })
    /*删除*/


</script>
{/block}